
import { employeeListAll } from "@/api/employee";
import { findAll } from "@/api/dept";

export async function dialogsFunc() {
    const { data = [] } = await employeeListAll()
    const users = data.map(item => {
        return {
            label: item.user_name,
            value: `${item.user_name},${item.id}`
        }
    })

    const { data: deptList = [] } = await findAll()
    const depts = deptList.map(item => {
        return {
            label: item.name,
            value: `${item.name},${item.id}`
        }
    })

    return {
        fields: [
            {
                el: 'str-input',
                label: '文件名',
                value: 'name',
                rule: { required: true },
                option: {}
            },
            {
                el: 'str-input',
                label: '文件类型',
                value: 'type',
                rule: { required: true },
                option: {}
            },
            {
                el: 'iv-select',
                label: '管理人',
                value: 'user',
                rule: { required: true },
                option: {
                    selects: users
                }
            },
            {
                el: 'iv-select',
                label: '归属',
                value: 'dept',
                rule: { required: true },
                option: {
                    selects: depts
                }
            }
        ]
    }
}